import React from 'react'
import classNames from 'classnames'

const renderLabel = (label, labelCols, htmlFor) => {
    if (label) {
        return <label
            className={classNames("label", `col-${labelCols}`)}
            htmlFor={htmlFor}>
            {label}
        </label>
    }
    return null
}

const FormRow = (props) => {
    let {
        className,
        label,
        htmlFor,
        labelCols = 4,
        cols = 20,
        //help,
        children
    } = props
    return (
        <div className={classNames("form-row", className)}>
            {renderLabel(label, labelCols, htmlFor)}
            <div className={classNames(`col-${cols}`)}>{children}</div>
        </div>
    )
}
export {FormRow}